home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: news.gil.com.au!news
- From: pcollins@gil.com.au (Peter Collins)
- Subject: HELP - using list class in TC++ V3
- Sender: news@gil.com.au
- Message-ID: <Dq1H6r.K8t@gil.com.au>
- Date: Thu, 18 Apr 1996 15:45:05 GMT
- X-Nntp-Posting-Host: ppp9.ipswich.gil.com.au
- Organization: Global Infolinks Internet Server, Ipswich Qld Australia
- X-Newsreader: Forte Agent .99b.112
-
- I am attempting to use the List class in Borland Turbo C++ V3 for DOS
- I cannot see what is wrong.
- Thanks in advance if you can help.
-
- #include <iostreams.h>
- #include <list.h>
- #include <strng.h>
-
- // Turbo C++ program for DOS
- // I am trying to use the List class to store a list of objects.
- // However I get the error messages below - I'v included them as
- comments.
-
- // declare a object
- class nc {
- private:
- int a;
-
- public:
- int b;
- nc(void){;};
- ~nc(void){;};
- };
-
-
- void main()
- {
-
- List alist; // declare a list
- nc h; // declare a instance of the object above
-
- alist.add(h); // try and add it to the list
-
- }
-
- // Error messages when attempt to compile this file
- // Compiling LISTTST1.CPP:
- // Warning LISTTST1.CPP 21: Temporary used for parameter 1 in call to
- 'List::add(Object &)'
- // Error LISTTST1.CPP 21: Cannot create instance of abstract class
- 'Object'
- // Error LISTTST1.CPP 21: Cannot create instance of abstract class
- 'Object'
- // Error LISTTST1.CPP 21: Could not find a match for
- 'Object::Object(nc)'
- // Error LISTTST1.CPP 21: Type mismatch in parameter 1 in call to
- 'List::add(Object &)'
-
-
- // This is the help file entry for list
- // List::add (member function)
- // Declaration:
- // void add(Object& toAdd);
- // Remarks:
- // Adds an object to the list. The object becomes the new head of the
- list.
- // See Also:
- // List
-
-
-
- --
- pcollins@gil.com.au
-
-